home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Select (Limited Edition)
/
Computer Select.iso
/
pcmag
/
v10n20
/
wvsp.pas
< prev
Wrap
Pascal/Delphi Source File
|
1991-10-21
|
1KB
|
51 lines
WVSP.PAS
PROGRAM wVsp;
USES WinCRT, Strings, WinProcs;
VAR
Data : Record
CASE Boolean OF
TRUE : (L : LongInt);
FALSE : (Free, Avail, Pct : Word);
END;
DatStr : ARRAY[0..255] OF Char;
CONST
PC : PChar = 'Turbo Pascal';
{Undocumented Kernel function #138}
FUNCTION GetHeapSpaces(hModule : Word) : LongInt; FAR;
External 'KERNEL' Index 138;
BEGIN
Data.L := GetHeapSpaces(GetModuleHandle('GDI'));
Data.Pct := (LongInt(Data.Free) * 100) DIV Data.Avail;
wvsprintf(DatStr,'GDI has %u heap bytes free out of '+
'%u - %u%% free.', Data);
WriteLn(DatStr);
Data.L := GetHeapSpaces(GetModuleHandle('USER'));
Data.Pct := (LongInt(Data.Free) * 100) DIV Data.Avail;
wvsprintf(DatStr,'USER has %Xh heap bytes free out of '+
'%Xh - %u%% free.', Data);
WriteLn(DatStr);
wvsprintf(DatStr,'Again, that''s %u%%', Data.Pct);
WriteLn(DatStr);
WriteLn;
wvsprintf(DatStr,'The PChar, padded to 20 chars with '+
'zeroes, is "%020s"', PC);
WriteLn(DatStr);
wvsprintf(DatStr,'Its address, treated as a hex '+
'LongInt, is %08lx', PC);
WriteLN(DatStr);
wvsprintf(DatStr,'The offset is %04X and the segment '+
'is %04X',PC);
WriteLn(DatStr);
END.